package com.nkbh.sevenday.mykotlin.activity

import android.content.Intent
import android.support.v7.app.AppCompatActivity
import android.os.Bundle
import android.os.Handler
import android.os.Looper
import android.os.Message
import com.nkbh.sevenday.mykotlin.R

class WelcomeActivity : AppCompatActivity() {

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_welcome)

        Thread(
                Runnable {
                    kotlin.run {
                        handler.sendEmptyMessageDelayed(1,3000)
                    }
                }
        ).start()

    }

    val handler:Handler= object : Handler(Looper.getMainLooper()){
        override fun handleMessage(msg: Message?) {
            super.handleMessage(msg)
            if (msg?.what==1){
                var intent = Intent()
                intent.setClass(this@WelcomeActivity, LoginActivity::class.java)
                startActivity(intent)
                finish()
            }
        }
    }

}
